package com.bckj.fastboot.core.operation.interceptor;

import com.bckj.fastboot.core.operation.context.OperationContext;

public abstract class AbstractOperationInterceptor implements OperationInterceptor {
    private final OperationInterceptor interceptor;

    public AbstractOperationInterceptor(OperationInterceptor interceptor) {
        this.interceptor = interceptor;
    }

    @Override
    public void beforeExecute(OperationContext context) {
        if (interceptor != null) {
            interceptor.beforeExecute(context);
        }
    }

    @Override
    public void afterExecute(OperationContext context, Throwable error) {
        if (interceptor != null) {
            interceptor.afterExecute(context, error);
        }
    }
}
